home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / pascal / mrgsort.zip / UCLOCK.PAS < prev   
Pascal/Delphi Source File  |  1990-02-22  |  2KB  |  67 lines

  1. UNIT uclock;
  2.  
  3. INTERFACE
  4. (* Public Domain.  Inspired by a C version by David L. Fox, *)
  5. (* which in turn depended on an article by Byron Sheppard,  *)
  6. (* Byte, Jan 1987, p157..164. This code is quite different. *)
  7. (* C.B. Falconer, 17 Feb 1990.      1:141/209.1@fidonet     *)
  8.  
  9. (* Warning - the timer is left in mode 2, rather than the   *)
  10. (* original mode 3.  This means that the interrupt signal   *)
  11. (* will be a pulse about 1 uS long, rather than a square    *)
  12. (* wave.  Under some conditions this may fail to interrupt. *)
  13. (* I do not anticipate problems outside the PS2 family.     *)
  14.  
  15.   FUNCTION clock : real;
  16.   (* Returns time in hours after midnight, with 128 added.  *)
  17.   (* See notes in CLOCK.ASM.  This format allows speed.     *)
  18.  
  19.   (* 1---------------1 *)
  20.  
  21.   FUNCTION version(print : boolean) : integer;
  22.   (* Show version number, optionally display *)
  23.  
  24. IMPLEMENTATION
  25.  
  26.   CONST
  27.     ver      = 100;   (* 1.00 - initial release *)
  28.     copyrite = ' Public Domain 1990 by C.B. Falconer';
  29.  
  30. (*$l clock.obj *)
  31.  
  32.   (* 1---------------1 *)
  33.  
  34.   PROCEDURE initc; external;
  35.   (* changes the timer mode *)
  36.  
  37.   (* 1---------------1 *)
  38.  
  39.   FUNCTION clk : real; external;  (* the real work *)
  40.  
  41.   (* 1---------------1 *)
  42.  
  43.   FUNCTION clock : real;
  44.  
  45.     BEGIN
  46.     clock := clk;
  47.     END;
  48.  
  49.   (* 1---------------1 *)
  50.  
  51.   FUNCTION version(print : boolean) : integer;
  52.   (* Show version number, optionally display *)
  53.  
  54.     BEGIN (* version *)
  55.     version := ver;
  56.     IF print THEN BEGIN
  57.       write('UCLOCK   module Version ', ver DIV 100 : 1, '.');
  58.       IF ver MOD 100 < 10 THEN write('0');
  59.       writeln(ver MOD 100, '.', copyrite); END;
  60.     END; (* version *)
  61.  
  62.   (* 1---------------1 *)
  63.  
  64.   BEGIN (* uclock initialization *)
  65.   initc;
  66.   END. (* uclock initialization *)
  67. ▀